use opencv::prelude::*;
use opencv::videoio;

pub fn test_camera() -> Result<(), String> {
    if let Ok(mut cam) = videoio::VideoCapture::new(0, videoio::CAP_ANY) {
        if let Ok(is_open) = cam.is_opened() {
            if is_open {
                //释放摄像头
                let _ = cam.release();
                return Ok(());
            }
        }
    }
    Err("无法打开摄像头".to_string())
}
